home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue61 / Clinic / Object Browser / StringsEditorFormU.pas < prev   
Encoding:
Pascal/Delphi Source File  |  2000-03-29  |  1.3 KB  |  62 lines

  1. unit StringsEditorFormU;
  2.  
  3. {$ifdef Ver100} { Delphi 3.0x }
  4.   {$define DelphiLessThan4}
  5.   {$define DelphiLessThan5}
  6. {$endif}
  7. {$ifdef Ver110} { C++ Builder 3.0x }
  8.   {$define DelphiLessThan4}
  9.   {$define DelphiLessThan5}
  10. {$endif}
  11. {$ifdef Ver120} { Delphi 4.0x }
  12.   {$define DelphiLessThan5}
  13. {$endif}
  14.  
  15. interface
  16.  
  17. uses
  18.   TypInfo,
  19.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  20.   StdCtrls;
  21.  
  22. type
  23.   TStringsEditorForm = class(TForm)
  24.     memTStrings: TMemo;
  25.     btnOK: TButton;
  26.     btnCancel: TButton;
  27.     procedure btnOKClick(Sender: TObject);
  28.   private
  29.     FPropInfo: PPropInfo;
  30.     FObject: TObject;
  31.   public
  32.     constructor Create(Obj: TObject; PropInfo: PPropInfo);
  33.       {$ifndef DelphiLessThan4}reintroduce;{$endif}
  34.   end;
  35.  
  36. var
  37.   StringsEditorForm: TStringsEditorForm;
  38.  
  39. implementation
  40.  
  41. {$R *.DFM}
  42.  
  43. uses
  44.   PropertyHelper;
  45.  
  46. { TStringsEditorForm }
  47.  
  48. constructor TStringsEditorForm.Create(Obj: TObject; PropInfo: PPropInfo);
  49. begin
  50.   inherited Create(Application);
  51.   FObject := Obj;
  52.   FPropInfo := PropInfo;
  53.   memTStrings.Lines := GetObjectProp(FObject, FPropInfo, TStrings) as TStrings;
  54. end;
  55.  
  56. procedure TStringsEditorForm.btnOKClick(Sender: TObject);
  57. begin
  58.   SetObjectProp(FObject, FPropInfo, memTStrings.Lines)
  59. end;
  60.  
  61. end.
  62.